package com.cbgolf.oa.model;

import android.app.Activity;
import android.content.Intent;

import com.cbgolf.oa.base.BaseModel;
import com.cbgolf.oa.net.NetCallBack;
import com.cbgolf.oa.net.Web;
import com.cbgolf.oa.net.WebAPI;
import com.cbgolf.oa.presenter.IPresenterImp;
import com.cbgolf.oa.util.DataUtil;
import com.cbgolf.oa.viewbean.OrderBean;

/**
 * Created by lq on 2017/11/2.
 */

public class BillModel extends BaseModel {

    private IPresenterImp worker;

    private String orderId;

    public BillModel(Activity act, IPresenterImp worker) {
        this.worker = worker;
        super.init(act);
    }

    @Override
    protected void getInitData() {
        Intent intent = context.getIntent();
        orderId = DataUtil.getStringExtra(intent, "id");
        getOrderInfo();
    }

    private void getOrderInfo() {
        String url = WebAPI.order_details_get + "/" + orderId;
        worker.showProgress();
        Web.getOK(url, new NetCallBack(response -> {
            beanResult(response,OrderBean.class, worker);

        }));
    }


}
